package com.stars.easyms.logger.support.logback.util;

import ch.qos.logback.classic.boolex.JaninoEventEvaluator;
import ch.qos.logback.core.AppenderBase;
import ch.qos.logback.core.UnsynchronizedAppenderBase;
import ch.qos.logback.core.filter.EvaluatorFilter;
import ch.qos.logback.core.joran.spi.DefaultNestedComponentRegistry;
import ch.qos.logback.core.net.ssl.SSLNestedComponentRegistryRules;
import com.stars.easyms.logger.support.logback.pattern.EasyMsPatternLayout;
import com.stars.easyms.logger.support.logback.pattern.EasyMsPatternLayoutEncoder;

/**
 * <p>className: EasyMsDefaultNestedComponentRules</p>
 * <p>description: 重写DefaultNestedComponentRules类</p>
 *
 * @author guoguifang
 * @date 2019-08-21 14:40
 * @since 1.3.0
 */
public final class EasyMsDefaultNestedComponentRules {

    public static void addDefaultNestedComponentRegistryRules(DefaultNestedComponentRegistry registry) {
        registry.add(AppenderBase.class, "layout", EasyMsPatternLayout.class);
        registry.add(UnsynchronizedAppenderBase.class, "layout", EasyMsPatternLayout.class);

        registry.add(AppenderBase.class, "encoder", EasyMsPatternLayoutEncoder.class);
        registry.add(UnsynchronizedAppenderBase.class, "encoder", EasyMsPatternLayoutEncoder.class);

        registry.add(EvaluatorFilter.class, "evaluator", JaninoEventEvaluator.class);

        SSLNestedComponentRegistryRules.addDefaultNestedComponentRegistryRules(registry);
    }

    private EasyMsDefaultNestedComponentRules() {
    }
}